package com.ruoyi.report.forms.controller;

import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.report.forms.service.IPatrolInspectionChangeShiftsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 巡检交接班管理Controller
 *
 * @author mashuang
 * @date 2022-08-22
 */
@RestController
@RequestMapping("/patrolInspectionChangeShifts")
public class PatrolInspectionChangeShiftsController extends BaseController {
    @Autowired
    private IPatrolInspectionChangeShiftsService patrolInspectionChangeShiftsService;

    @PostMapping("/getShiftsInfo/{position}/{date}")
    public AjaxResult getShiftsInfo(@PathVariable("position") String position, @PathVariable("date") String date) {
        if (StringUtils.isEmpty(position)) {
            return AjaxResult.error("场站ID不为空");
        }
        if (StringUtils.isEmpty(date)) {
            return AjaxResult.error("日期不为空");
        }
        return AjaxResult.success(patrolInspectionChangeShiftsService.selectShiftsInfo(position, date));
    }
}
